﻿using System;

using System.Collections.Generic;
using System.Text;

namespace NetToolsV2
{
    public class IpOptionInformation
    {
        private byte[] m_data;

        public IpOptionInformation(int size) 
        {
            m_data = new byte[size];
        }

        public byte[] Buffer 
        { 
            get 
            {
                return m_data; 
            }
        }

        #region IP_OPTION_INFORMATION Structure
        public byte Ttl
        {
            get
            {
                return m_data[0x00];
            }
            set
            {
                m_data[0x00] = value;
            }
        }

        public byte Tos
        {
            get
            {
                return m_data[0x01];
            }
        }

        public byte Flags
        {
            get
            {
                return m_data[0x02];
            }
        }

        public byte OptionsSize
        {
            get
            {
                return m_data[0x03];
            }
        }

        public IntPtr OptionsData
        {
            get
            {
                return new IntPtr(BitConverter.ToInt32(m_data, 0x04));
            }
            set
            {
                BitConverter.GetBytes(value.ToInt32()).CopyTo(m_data, 0x04);
            }
        }

        #endregion
    }
}
